﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; 
using TradePublish.Common;
using Winista.Text.HtmlParser;
using Winista.Text.HtmlParser.Filters;
using Winista.Text.HtmlParser.Util;
using System.Threading;
using System.Text.RegularExpressions;
using Winista.Text.HtmlParser.Tags;
using System.Text;
using log4net;
using System.Reflection;
using TradePublish.Common;
namespace TradePublish.SysThread.Grasp
{
    /// <summary>
    /// 
    /// </summary>
    public class MonitorThread
    {
        //商标公告url
       
        private Thread doThread;
        ILog log = null;
        public MonitorThread()
        {
            log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
        }

        public void start()
        {
            doThread = new Thread(threadWork);
            doThread.IsBackground = true;
            doThread.Start();
        }

        /// <summary>
        /// 监测线程的主函数
        /// </summary>
        private void threadWork()
        {
            while (true)
            {
                SystemInfo systemInfo = new SystemInfo();
                MemoryInfo memoryInfo = systemInfo.GetMemoryInfo(); 
                log.Debug("++++++++++++++可用交换文件大小：" + memoryInfo.dwAvailPageFile);
                log.Debug("++++++++++++++可用物理内存大小：" + memoryInfo.dwAvailPhys );
                log.Debug("++++++++++++++可用虚拟内存大小" + memoryInfo.dwAvailVirtual );
                log.Debug("++++++++++++++已经使用内存大小：" + memoryInfo.dwMemoryLoad );
                log.Debug("++++++++++++++交换文件总大小：" + memoryInfo.dwTotalPageFile );
                log.Debug("++++++++++++++总物理内存大小：" + memoryInfo.dwTotalPhys );
                log.Debug("++++++++++++++总虚拟内存大小：" + memoryInfo.dwTotalVirtual );
                log.Info("本检测线程MonitorThread休息10分钟."); 
                Thread.Sleep(600000);//休息10分钟。  
            }
        } 
    }
}